<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListOrgaoUsuarioTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form id="form" styleClass="jsfcrud_list_form">
                <p:growl id="messages" life="3000"/>

                <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
                </h:panelGroup>

                <h:panelGroup>                    

                    <p:dataTable value="#{orgaoUsuarioController.lista}" var="item"  paginator="true" rows="10"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rowsPerPageTemplate="5,10,15,20" rowKey="#{item.useId}" paginatorPosition="both" emptyMessage="#{bundle.ListOrgaoUsuarioEmpty}" selection="#{orgaoUsuarioController.selectedOrgaoUsuario}" selectionMode="single">

                        <p:column styleClass="firstColumn" filterBy="#{item.useId}" filterMatchMode="contains" sortBy="#{item.useId}">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrgaoUsuarioTitle_useId}"/>
                            </f:facet>
                            <h:outputText value="#{item.useId}"/>
                        </p:column>
                        <p:column filterBy="#{item.useOrgId.orgNm}" filterMatchMode="contains" sortBy="#{item.useOrgId.orgNm}">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrgaoUsuarioTitle_useOrgId}"/>
                            </f:facet>
                            <h:outputText value="#{item.useOrgId.orgNm}"/>
                        </p:column> 
                        <p:column  sortBy="#{item.useSe == null}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrgaoUsuarioTitle_senhaCadastrada}"/>
                            </f:facet>                       

                            <h:outputText value="#{item.useSe}"/>                            
                        </p:column> 

                        <f:facet name="footer">                            
                            <p:commandButton id="createCommand" ajax="false" icon="ui-icon-document" action="#{orgaoUsuarioController.prepareCreate}" value="#{bundle.ListOrgaoUsuarioCreateLink}"/>
                            <p:commandButton id="viewCommand" value="#{bundle.MsgVisualizar}" icon="ui-icon-search"  update=":formList:displayView" oncomplete="dialogView.show()" />
                            <p:commandButton id="editCommand" ajax="false"  action="#{orgaoUsuarioController.prepareEdit}" value="#{bundle.ViewOrgaoUsuarioEditLink}" icon="ui-icon-pencil" />
                            <p:commandButton id="deleteCommand"  onclick="confirmationDestroy.show();" value="#{bundle.ViewOrgaoUsuarioDestroyLink}" type="button" icon="ui-icon-trash" />
                        </f:facet>

                    </p:dataTable>

                    <p:confirmDialog id="confirmDestroy" message="#{bundle.MsgConfirmDestroy_message}" header="#{bundle.MsgConfirmDestroy_header}" severity="alert" widgetVar="confirmationDestroy">
                        <p:commandButton id="confirm" ajax="false" value="#{bundle.MsgDialog_confirmar}"  oncomplete="confirmationDestroy.hide();" actionListener="#{orgaoUsuarioController.destroy}" />
                        <p:commandButton id="decline"  value="#{bundle.MsgDialog_cancelar}" update="messages" onclick="confirmationDestroy.hide();" type="button"/>

                    </p:confirmDialog>

                    <p:dialog id="dialogView" header="#{bundle.OrgaoUsuarioDialogView_header}" widgetVar="dialogView" resizable="false"
                              width="500" >
                        <h:panelGrid id="displayView" columns="2" cellpadding="4">

                            <h:outputText value="#{bundle.ViewOrgaoUsuarioLabel_useId}"/>
                            <h:outputText value="#{orgaoUsuarioController.selected.useId}" title="#{bundle.ViewOrgaoUsuarioTitle_useId}"/>
                            <h:outputText value="#{bundle.ViewOrgaoUsuarioLabel_useOrgId}"/>
                            <h:outputText value="#{orgaoUsuarioController.selected.useOrgId.orgNm}" title="#{bundle.ViewOrgaoUsuarioTitle_useOrgId}"/>                           
                        </h:panelGrid>
                    </p:dialog>
                </h:panelGroup>                
            </h:form>
        </ui:define>
    </ui:composition>

</html>
